{include file=member.header.html}

<script type="text/javascript">

$(function(){
    $('#edit_phone').validate({
        errorPlacement: function(error, element){
            $(element).next('.field_notice').hide();
            $(element).after(error);
        },
        success       : function(label){
            label.addClass('validate_right').text('OK!');
        },
        rules : {
            password : {
                required : true,
                maxlength : 20,
                minlength : 6
            },
             /*vcode : {
                required : true
            },*/
           phone_mob : {
                digits:true,
                phone_mob : true,
                remote   : {
                    url :'index.php?app=member&act=check_phone&ajax=1',
                    type:'get',
                    data:{
                        phone_mob : function(){
                            var phone_mob=$('#phone_mob').val();                           
                            return phone_mob;
                        }
                    },
                    beforeSend:function(){
                        var _checking = $('#checking_phone_mob');
                        _checking.prev('.field_notice').hide();
                        _checking.next('label').hide();
                        $(_checking).show();
                    },
                    complete :function(){
                        $('#checking_phone_mob').hide();
                    }
                }
            }
        },
        messages : {
            password : {
                required : '{$lang.no_pass}',
                minlength  : '{$lang.password_length_limit}',
                maxlength  : '{$lang.password_length_limit}'
            },
             /*vcode : {
                required :  '{$lang.vcode_required}'
            },*/
            phone_mob : {
                digits  : '{$lang.verify_phone}',
                phone_mob :'{$lang.verify_phone}',
                 remote:'手机号已存在'
            }
        }
    });

    $("#send_email").click(function(event) {

        $.getJSON('index.php?app=member&act=send_email', function(result){
            // 发送邮件，
            //alert("发送成功");
            if(result == 1)
            {
                alert('验证码已发送成功！请到邮箱查收');
                $("#valid_desc").show();
            }else{
                alert('验证码发送失败，请联系管理员');
                $("#valid_desc").hide();
            }
        });        
    });
});

jQuery.validator.addMethod("phone_mob", function(value, element) {

    var length = value.length;

    var mobile =  /^[1][3-9][0-9]{9}$/

    return this.optional(element) || (length == 11 && mobile.test(value));

}, "手机号码格式错误");

</script>

<style>
.borline td { padding:10px 0px; }
.ware_list th { text-align:left; }
.bgwhite { background: #FFFFFF;}
</style>
<div class="content">
    {include file=member.menu.html}
    <div id="right">
    		{include file=member.curlocal.html}
            {include file=member.submenu.html}
            <div class="wrap">
            <div class="eject_con bgwhite">
            <div class="add">
                <div id="valid_desc" style="display: none;height: 30px;">{$lang.valid_note}</div>
                
                <form method="post" enctype="multipart/form-data" id="edit_phone">
                    <div class="information">
                        <div class="info individual">
                    <ul>
                        <li><h3>{$lang.password}:</h3>
                        <p><input class="text width_normal" type="password" name="password" /></p>
                        </li>
                        <li><h3>{$lang.new_phone}:</h3>
                        <p><input class="text width_normal" type="text" id="phone_mob" name="phone_mob" /><div class="clr"></div><label></label>
                        </p>
                        </li>
                         <li ><h3>{$lang.valid_code}:</h3>
                        <p><input class="text width_normal" type="text" name="vcode" value="" />
                            <input type="button" id="send_email" class="btn"value="发送电子邮件"  />
                        </p>
                        </li>
                    </ul>
                    <div class="submit">
                        <input class="btn" type="submit" value="{$lang.submit}" />
                    </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        </div>
    </div>
    <div class="clear"></div>
</div>
{include file=footer.html}
